<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
  <link th:href="@{/css/style.css}" rel="stylesheet" type="text/css" />
  <script type="text/javascript" th:src="@{/js/jquery.js}"></script>
</head>

<body>
<div class="place"> <span>位置：</span>
  <ul class="placeul">
    <li>数据统计</li>
    <li>厂商采购统计</li>
    <li>采购详情</li>
  </ul>
</div>
<div class="rightinfo">
  <form action="" method="post">
    <table class="tablelist">
      <thead>
        <tr>
          <th>序号</th>
          <th>厂商名称</th>
          <th>采购单编号</th>
          <th>商品数量</th>
          <th>金额</th>
          <th>采购时间</th>
          <th>操作人</th>
          <th>采购单详情</th>
        </tr>
      </thead>
      <tbody>
        <tr th:each="p,var:${plist.list}">
          <td th:text="${(plist.pageNum-1)*plist.pageSize+var.count}">1</td>
          <td th:text="${p.firmName}">阿里巴巴</td>
          <td th:text="${p.purchaseId}">CG201701270001</td>
          <td th:text="${p.count}">5</td>
          <td th:text="${p.totalMoney}">￥76,582</td>
          <td th:text="${#dates.format(p.purchaseDate,'yyyy-MM-dd')}">2017-01-25 15:05:05</td>
          <td th:text="${p.users.uname}">马云</td>
          <td>
          	<a th:href="@{/purchase/details?purchaseId=}+${p.purchaseId}" class="tablelink">查看详情</a>
          </td>
        </tr>
      </tbody>
    </table>
    <div class="pagin">
      <div class="message">共<i class="blue" th:text="${plist.total}">1256</i>条记录，当前显示第&nbsp;<i class="blue" th:text="${plist.pageNum}">2&nbsp;</i>页</div>
      <ul class="paginList">
        <li class="paginItem" th:onclick="goPage([[${plist.pageNum-1}]])"><a href="javascript:;"><span class="pagepre"></span></a></li>
        <li class="paginItem" th:onclick="goPage(1)" th:class="${plist.pageNum==1?'paginItem current':'paginItem'}"><a href="javascript:;">1</a></li>

        <li th:each="p:${listPage}" th:class="${plist.pageNum==p?'paginItem current':'paginItem'}" th:onclick="goPage([[${p}]])"><a th:text="${p}" href="javascript:;">2</a></li>

        <li class="paginItem" th:if="${plist.pages!=1 and plist.pages!=0}" th:onclick="goPage([[${plist.pages}]])" th:class="${plist.pageNum==plist.pages?'paginItem current':'paginItem'}"><a href="javascript:;" th:text="${plist.pages}" id="pages" >10</a></li>
        <li class="paginItem"  th:onclick="goPage([[${plist.pageNum+1}]])"><a href="javascript:;"><span class="pagenxt"></span></a></li>
      </ul>
      <input name="" type="button" class="btn" value="返回" onclick="location.href='/erp/purchaseStatistics/lists'"/>
    </div>
  </form>
  <input id="firmId" type="hidden" th:value="${firmId}">
</div>
<script type="text/javascript">
  // 页面跳转
  function goPage(num){
    var firmId = $("#firmId").val();
    // 最后一页
    var pages = $("#pages").text();
    if(num>=1 && num<=pages){
      location.href="/erp/purchaseStatistics/details?pageno="+num+"&firmId="+firmId;
    }
  }
	$('.tablelist tbody tr:odd').addClass('odd');
</script>
</body>
</html>
